<?php
/**
 * DefinitionsApiTest
 * PHP version 8.3
 *
 * @category Class
 * @package  SpApi
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */

/**
 * Selling Partner API for Product Type Definitions
 *
 * The Selling Partner API for Product Type Definitions provides programmatic access to attribute and data requirements for product types in the Amazon catalog. Use this API to return the JSON Schema for a product type that you can then use with other Selling Partner APIs, such as the Selling Partner API for Listings Items, the Selling Partner API for Catalog Items, and the Selling Partner API for Feeds (for JSON-based listing feeds).  For more information, see the [Product Type Definitions API Use Case Guide](doc:product-type-api-use-case-guide).
 *
 * The version of the OpenAPI document: 2020-09-01
 * Generated by: https://openapi-generator.tech
 * Generator version: 7.9.0
 */

/**
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Please update the test case below to test the endpoint.
 */

namespace SpApi\Test\Api;

use SpApi\ApiException;
use SpApi\Api\productTypeDefinitions\v2020_09_01\DefinitionsApi;
use SpApi\ObjectSerializer;

/**
 * DefinitionsApiTest Class Doc Comment
 *
 * @category Class
 * @package  SpApi
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */
class DefinitionsApiTest extends BaseTestCase
{
    private DefinitionsApi $apiInstance;
    public function setUp(): void
    {
        parent::setUp();
        // Initialize parameter value specific to case
        $this->testHelper->setSpecificValue('DefinitionsApi', $this->getName());
        $this->apiInstance = new DefinitionsApi($this->config, null);
        // Change Time Format if it requires
        $specificTimeFormat = $this->testHelper->getDateTimeFormatForCase('DefinitionsApi');
        if ($specificTimeFormat) {
            ObjectSerializer::setDateTimeFormat($specificTimeFormat);
        }
    }

    /**
     * Test case for getDefinitionsProductType_200
     */
    public function testGetDefinitionsProductType200()
    {
        try {
            // Skip test if it is in the skip list
            if ($this->testHelper->shouldSkipTest('testGetDefinitionsProductType200', 'DefinitionsApi')) {
                $this->assertTrue(true);
                return;
            }
            $jsonSchema = '{
  &quot;description&quot; : &quot;Successfully retrieved an Amazon product type definition.&quot;,
  &quot;headers&quot; : {
    &quot;x-amzn-RequestId&quot; : {
      &quot;description&quot; : &quot;Unique request reference identifier.&quot;,
      &quot;schema&quot; : {
        &quot;type&quot; : &quot;string&quot;
      }
    },
    &quot;x-amzn-RateLimit-Limit&quot; : {
      &quot;description&quot; : &quot;Your rate limit (requests per second) for this operation.&quot;,
      &quot;schema&quot; : {
        &quot;type&quot; : &quot;string&quot;
      }
    }
  },
  &quot;content&quot; : {
    &quot;application/json&quot; : {
      &quot;schema&quot; : {
        &quot;$ref&quot; : &quot;#/components/schemas/ProductTypeDefinition&quot;
      },
      &quot;example&quot; : {
        &quot;metaSchema&quot; : {
          &quot;link&quot; : {
            &quot;resource&quot; : &quot;https://meta-schema-url&quot;,
            &quot;verb&quot; : &quot;GET&quot;
          },
          &quot;checksum&quot; : &quot;c7af9479ca7261645cea9db56c5f720d&quot;
        },
        &quot;schema&quot; : {
          &quot;link&quot; : {
            &quot;resource&quot; : &quot;https://schema-url&quot;,
            &quot;verb&quot; : &quot;GET&quot;
          },
          &quot;checksum&quot; : &quot;c7af9479ca7261645cea9db56c5f720d&quot;
        },
        &quot;requirements&quot; : &quot;LISTING&quot;,
        &quot;requirementsEnforced&quot; : &quot;ENFORCED&quot;,
        &quot;propertyGroups&quot; : {
          &quot;product_identity&quot; : {
            &quot;title&quot; : &quot;Product Identity&quot;,
            &quot;description&quot; : &quot;Information to uniquely identify your product (e.g., UPC, EAN, GTIN, Product Type, Brand)&quot;,
            &quot;propertyNames&quot; : [ &quot;item_name&quot;, &quot;brand&quot;, &quot;external_product_id&quot;, &quot;gtin_exemption_reason&quot;, &quot;merchant_suggested_asin&quot;, &quot;product_type&quot;, &quot;product_category&quot;, &quot;product_subcategory&quot;, &quot;item_type_keyword&quot; ]
          }
        },
        &quot;locale&quot; : &quot;en_US&quot;,
        &quot;marketplaceIds&quot; : [ &quot;ATVPDKIKX0DER&quot; ],
        &quot;productType&quot; : &quot;LUGGAGE&quot;,
        &quot;displayName&quot; : &quot;Luggage&quot;,
        &quot;productTypeVersion&quot; : {
          &quot;version&quot; : &quot;UHqSqmb4FNUk&#x3D;&quot;,
          &quot;latest&quot; : true,
          &quot;releaseCandidate&quot; : false
        }
      }
    }
  },
  &quot;x-amzn-api-sandbox&quot; : {
    &quot;static&quot; : [ {
      &quot;request&quot; : {
        &quot;parameters&quot; : { }
      },
      &quot;response&quot; : {
        &quot;metaSchema&quot; : {
          &quot;link&quot; : {
            &quot;resource&quot; : &quot;https://meta-schema-url&quot;,
            &quot;verb&quot; : &quot;GET&quot;
          },
          &quot;checksum&quot; : &quot;c7af9479ca7261645cea9db56c5f720d&quot;
        },
        &quot;schema&quot; : {
          &quot;link&quot; : {
            &quot;resource&quot; : &quot;https://schema-url&quot;,
            &quot;verb&quot; : &quot;GET&quot;
          },
          &quot;checksum&quot; : &quot;c7af9479ca7261645cea9db56c5f720d&quot;
        },
        &quot;requirements&quot; : &quot;LISTING&quot;,
        &quot;requirementsEnforced&quot; : &quot;ENFORCED&quot;,
        &quot;propertyGroups&quot; : {
          &quot;product_identity&quot; : {
            &quot;title&quot; : &quot;Product Identity&quot;,
            &quot;description&quot; : &quot;Information to uniquely identify your product (e.g., UPC, EAN, GTIN, Product Type, Brand)&quot;,
            &quot;propertyNames&quot; : [ &quot;item_name&quot;, &quot;brand&quot;, &quot;external_product_id&quot;, &quot;gtin_exemption_reason&quot;, &quot;merchant_suggested_asin&quot;, &quot;product_type&quot;, &quot;product_category&quot;, &quot;product_subcategory&quot;, &quot;item_type_keyword&quot; ]
          }
        },
        &quot;locale&quot; : &quot;en_US&quot;,
        &quot;marketplaceIds&quot; : [ &quot;ATVPDKIKX0DER&quot; ],
        &quot;productType&quot; : &quot;LUGGAGE&quot;,
        &quot;displayName&quot; : &quot;Luggage&quot;,
        &quot;productTypeVersion&quot; : {
          &quot;version&quot; : &quot;UHqSqmb4FNUk&#x3D;&quot;,
          &quot;latest&quot; : true,
          &quot;releaseCandidate&quot; : false
        }
      }
    } ]
  }
}';
            $result = $this->testHelper->extractRequestAndResponse(
                $this->apiInstance,
                $jsonSchema,
                'getDefinitionsProductType'
            );
            $requestParams = $result['requestParams'];
            $expectedResponse = $result['expectedResponse'];

            // Change Time Format if it requires
            $specificTimeFormat = $this->testHelper->getDateTimeFormatForCase('DefinitionsApi');
            if ($specificTimeFormat) {
                ObjectSerializer::setDateTimeFormat($specificTimeFormat);
            }

            // Act: Call API
            list($response, $statusCode, $headers) =
                $this->apiInstance->getDefinitionsProductTypeWithHttpInfo(...array_values($requestParams));

            // Assert the response code
            $this->assertHttpStatusCode(200, $statusCode);

            // Handle different response codes
            $this->handleResponse($response, $statusCode, 200, $expectedResponse);
        } catch (ApiException $e) {
            $this->handleApiException($e, 200);
        } catch (\ReflectionException $e) {
            $this->fail("Reflection exception: " . $e->getMessage());
        }
    }
    /**
     * Test case for getDefinitionsProductType_400
     */
    public function testGetDefinitionsProductType400()
    {
        try {
            // Skip test if it is in the skip list
            if ($this->testHelper->shouldSkipTest('testGetDefinitionsProductType400', 'DefinitionsApi')) {
                $this->assertTrue(true);
                return;
            }
            $jsonSchema = '{
  &quot;description&quot; : &quot;Request has missing or invalid parameters and cannot be parsed.&quot;,
  &quot;headers&quot; : {
    &quot;x-amzn-RequestId&quot; : {
      &quot;description&quot; : &quot;Unique request reference identifier.&quot;,
      &quot;schema&quot; : {
        &quot;type&quot; : &quot;string&quot;
      }
    },
    &quot;x-amzn-RateLimit-Limit&quot; : {
      &quot;description&quot; : &quot;Your rate limit (requests per second) for this operation.&quot;,
      &quot;schema&quot; : {
        &quot;type&quot; : &quot;string&quot;
      }
    }
  },
  &quot;content&quot; : {
    &quot;application/json&quot; : {
      &quot;schema&quot; : {
        &quot;$ref&quot; : &quot;#/components/schemas/ErrorList&quot;
      }
    }
  },
  &quot;x-amzn-api-sandbox&quot; : {
    &quot;static&quot; : [ {
      &quot;request&quot; : {
        &quot;parameters&quot; : {
          &quot;productType&quot; : {
            &quot;value&quot; : &quot;INVALID&quot;
          }
        }
      },
      &quot;response&quot; : {
        &quot;errors&quot; : [ {
          &quot;code&quot; : &quot;BAD_REQUEST&quot;,
          &quot;message&quot; : &quot;Invalid input&quot;,
          &quot;details&quot; : &quot;Invalid input&quot;
        } ]
      }
    } ]
  }
}';
            $result = $this->testHelper->extractRequestAndResponse(
                $this->apiInstance,
                $jsonSchema,
                'getDefinitionsProductType'
            );
            $requestParams = $result['requestParams'];
            $expectedResponse = $result['expectedResponse'];

            // Change Time Format if it requires
            $specificTimeFormat = $this->testHelper->getDateTimeFormatForCase('DefinitionsApi');
            if ($specificTimeFormat) {
                ObjectSerializer::setDateTimeFormat($specificTimeFormat);
            }

            // Act: Call API
            list($response, $statusCode, $headers) =
                $this->apiInstance->getDefinitionsProductTypeWithHttpInfo(...array_values($requestParams));

            // Assert the response code
            $this->assertHttpStatusCode(400, $statusCode);

            // Handle different response codes
            $this->handleResponse($response, $statusCode, 400, $expectedResponse);
        } catch (ApiException $e) {
            $this->handleApiException($e, 400);
        } catch (\ReflectionException $e) {
            $this->fail("Reflection exception: " . $e->getMessage());
        }
    }
    /**
     * Test case for getDefinitionsProductType_403
     */
    public function testGetDefinitionsProductType403()
    {
        // Skip this test
        $this->markTestSkipped('Skip test for this operation.');
    }
    /**
     * Test case for getDefinitionsProductType_404
     */
    public function testGetDefinitionsProductType404()
    {
        // Skip this test
        $this->markTestSkipped('Skip test for this operation.');
    }
    /**
     * Test case for getDefinitionsProductType_413
     */
    public function testGetDefinitionsProductType413()
    {
        // Skip this test
        $this->markTestSkipped('Skip test for this operation.');
    }
    /**
     * Test case for getDefinitionsProductType_415
     */
    public function testGetDefinitionsProductType415()
    {
        // Skip this test
        $this->markTestSkipped('Skip test for this operation.');
    }
    /**
     * Test case for getDefinitionsProductType_429
     */
    public function testGetDefinitionsProductType429()
    {
        // Skip this test
        $this->markTestSkipped('Skip test for this operation.');
    }
    /**
     * Test case for getDefinitionsProductType_500
     */
    public function testGetDefinitionsProductType500()
    {
        // Skip this test
        $this->markTestSkipped('Skip test for this operation.');
    }
    /**
     * Test case for getDefinitionsProductType_503
     */
    public function testGetDefinitionsProductType503()
    {
        // Skip this test
        $this->markTestSkipped('Skip test for this operation.');
    }
    /**
     * Test case for searchDefinitionsProductTypes_200
     */
    public function testSearchDefinitionsProductTypes200()
    {
        try {
            // Skip test if it is in the skip list
            if ($this->testHelper->shouldSkipTest('testSearchDefinitionsProductTypes200', 'DefinitionsApi')) {
                $this->assertTrue(true);
                return;
            }
            $jsonSchema = '{
  &quot;description&quot; : &quot;Successfully retrieved a list of Amazon product types that have definitions available.&quot;,
  &quot;headers&quot; : {
    &quot;x-amzn-RequestId&quot; : {
      &quot;description&quot; : &quot;Unique request reference identifier.&quot;,
      &quot;schema&quot; : {
        &quot;type&quot; : &quot;string&quot;
      }
    },
    &quot;x-amzn-RateLimit-Limit&quot; : {
      &quot;description&quot; : &quot;Your rate limit (requests per second) for this operation.&quot;,
      &quot;schema&quot; : {
        &quot;type&quot; : &quot;string&quot;
      }
    }
  },
  &quot;content&quot; : {
    &quot;application/json&quot; : {
      &quot;schema&quot; : {
        &quot;$ref&quot; : &quot;#/components/schemas/ProductTypeList&quot;
      },
      &quot;example&quot; : {
        &quot;productTypes&quot; : [ {
          &quot;name&quot; : &quot;LUGGAGE&quot;,
          &quot;displayName&quot; : &quot;Luggage&quot;,
          &quot;marketplaceIds&quot; : [ &quot;ATVPDKIKX0DER&quot; ]
        } ],
        &quot;productTypeVersion&quot; : &quot;UHqSqmb4FNUk&#x3D;&quot;
      }
    }
  },
  &quot;x-amzn-api-sandbox&quot; : {
    &quot;static&quot; : [ {
      &quot;request&quot; : {
        &quot;parameters&quot; : { }
      },
      &quot;response&quot; : {
        &quot;productTypes&quot; : [ {
          &quot;name&quot; : &quot;LUGGAGE&quot;,
          &quot;displayName&quot; : &quot;Luggage&quot;,
          &quot;marketplaceIds&quot; : [ &quot;ATVPDKIKX0DER&quot; ]
        } ],
        &quot;productTypeVersion&quot; : &quot;UHqSqmb4FNUk&#x3D;&quot;
      }
    } ]
  }
}';
            $result = $this->testHelper->extractRequestAndResponse(
                $this->apiInstance,
                $jsonSchema,
                'searchDefinitionsProductTypes'
            );
            $requestParams = $result['requestParams'];
            $expectedResponse = $result['expectedResponse'];

            // Change Time Format if it requires
            $specificTimeFormat = $this->testHelper->getDateTimeFormatForCase('DefinitionsApi');
            if ($specificTimeFormat) {
                ObjectSerializer::setDateTimeFormat($specificTimeFormat);
            }

            // Act: Call API
            list($response, $statusCode, $headers) =
                $this->apiInstance->searchDefinitionsProductTypesWithHttpInfo(...array_values($requestParams));

            // Assert the response code
            $this->assertHttpStatusCode(200, $statusCode);

            // Handle different response codes
            $this->handleResponse($response, $statusCode, 200, $expectedResponse);
        } catch (ApiException $e) {
            $this->handleApiException($e, 200);
        } catch (\ReflectionException $e) {
            $this->fail("Reflection exception: " . $e->getMessage());
        }
    }
    /**
     * Test case for searchDefinitionsProductTypes_400
     */
    public function testSearchDefinitionsProductTypes400()
    {
        try {
            // Skip test if it is in the skip list
            if ($this->testHelper->shouldSkipTest('testSearchDefinitionsProductTypes400', 'DefinitionsApi')) {
                $this->assertTrue(true);
                return;
            }
            $jsonSchema = '{
  &quot;description&quot; : &quot;Request has missing or invalid parameters and cannot be parsed.&quot;,
  &quot;headers&quot; : {
    &quot;x-amzn-RequestId&quot; : {
      &quot;description&quot; : &quot;Unique request reference identifier.&quot;,
      &quot;schema&quot; : {
        &quot;type&quot; : &quot;string&quot;
      }
    },
    &quot;x-amzn-RateLimit-Limit&quot; : {
      &quot;description&quot; : &quot;Your rate limit (requests per second) for this operation.&quot;,
      &quot;schema&quot; : {
        &quot;type&quot; : &quot;string&quot;
      }
    }
  },
  &quot;content&quot; : {
    &quot;application/json&quot; : {
      &quot;schema&quot; : {
        &quot;$ref&quot; : &quot;#/components/schemas/ErrorList&quot;
      }
    }
  },
  &quot;x-amzn-api-sandbox&quot; : {
    &quot;static&quot; : [ {
      &quot;request&quot; : {
        &quot;parameters&quot; : {
          &quot;keywords&quot; : {
            &quot;value&quot; : [ &quot;Invalid Request&quot; ]
          }
        }
      },
      &quot;response&quot; : {
        &quot;errors&quot; : [ {
          &quot;code&quot; : &quot;BAD_REQUEST&quot;,
          &quot;message&quot; : &quot;Invalid input&quot;,
          &quot;details&quot; : &quot;Invalid input&quot;
        } ]
      }
    } ]
  }
}';
            $result = $this->testHelper->extractRequestAndResponse(
                $this->apiInstance,
                $jsonSchema,
                'searchDefinitionsProductTypes'
            );
            $requestParams = $result['requestParams'];
            $expectedResponse = $result['expectedResponse'];

            // Change Time Format if it requires
            $specificTimeFormat = $this->testHelper->getDateTimeFormatForCase('DefinitionsApi');
            if ($specificTimeFormat) {
                ObjectSerializer::setDateTimeFormat($specificTimeFormat);
            }

            // Act: Call API
            list($response, $statusCode, $headers) =
                $this->apiInstance->searchDefinitionsProductTypesWithHttpInfo(...array_values($requestParams));

            // Assert the response code
            $this->assertHttpStatusCode(400, $statusCode);

            // Handle different response codes
            $this->handleResponse($response, $statusCode, 400, $expectedResponse);
        } catch (ApiException $e) {
            $this->handleApiException($e, 400);
        } catch (\ReflectionException $e) {
            $this->fail("Reflection exception: " . $e->getMessage());
        }
    }
    /**
     * Test case for searchDefinitionsProductTypes_403
     */
    public function testSearchDefinitionsProductTypes403()
    {
        // Skip this test
        $this->markTestSkipped('Skip test for this operation.');
    }
    /**
     * Test case for searchDefinitionsProductTypes_404
     */
    public function testSearchDefinitionsProductTypes404()
    {
        // Skip this test
        $this->markTestSkipped('Skip test for this operation.');
    }
    /**
     * Test case for searchDefinitionsProductTypes_413
     */
    public function testSearchDefinitionsProductTypes413()
    {
        // Skip this test
        $this->markTestSkipped('Skip test for this operation.');
    }
    /**
     * Test case for searchDefinitionsProductTypes_415
     */
    public function testSearchDefinitionsProductTypes415()
    {
        // Skip this test
        $this->markTestSkipped('Skip test for this operation.');
    }
    /**
     * Test case for searchDefinitionsProductTypes_429
     */
    public function testSearchDefinitionsProductTypes429()
    {
        // Skip this test
        $this->markTestSkipped('Skip test for this operation.');
    }
    /**
     * Test case for searchDefinitionsProductTypes_500
     */
    public function testSearchDefinitionsProductTypes500()
    {
        // Skip this test
        $this->markTestSkipped('Skip test for this operation.');
    }
    /**
     * Test case for searchDefinitionsProductTypes_503
     */
    public function testSearchDefinitionsProductTypes503()
    {
        // Skip this test
        $this->markTestSkipped('Skip test for this operation.');
    }
}
